﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace JizCode.WPF
{
    public class Activity : UserControl
    {
        public ActivityHost ActivityHost { get; internal set; }

        public bool IsFirstActive { get; private set; }

        public Activity()
        {
            IsFirstActive = true;
        }

        public void Deactive()
        {
            OnDeactive();
        }

        public void Active()
        {
            OnActive();
            IsFirstActive = false;
        }

        public void Destory()
        {
            OnDestory();
        }

        public void Switch(Activity activity)
        {
            ActivityHost.Switch(activity);
        }

        protected virtual void OnActive()
        {

        }

        protected virtual void OnDeactive()
        {

        }

        protected virtual void OnDestory()
        {

        }
    }
}
